package com.ysy.tz.core.engine;

import com.zaxxer.hikari.HikariConfig;
import com.zaxxer.hikari.HikariDataSource;
import java.io.IOException;
import java.util.Properties;
import org.apache.ibatis.datasource.unpooled.UnpooledDataSourceFactory;
import org.apache.ibatis.io.Resources;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

public class PooledDataSource extends UnpooledDataSourceFactory {
    private Logger log = LoggerFactory.getLogger(PooledDataSource.class);

    public PooledDataSource() {
        this.log.debug("<<<--- ***** start init PooledDataSource ***** --->>>");
        Properties properties = new Properties();

        try {
            properties.load(Resources.getResourceAsStream("hikariPool.properties"));
            HikariConfig config = new HikariConfig(properties);
            config.setMaximumPoolSize(1);
            this.dataSource = new HikariDataSource(config);
        } catch (IOException var3) {
            var3.printStackTrace();
            System.exit(-1);
        }

        this.log.debug("<<<--- ***** init PooledDataSource finished ***** --->>>");
    }
}
